﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using Sunny.UI;

namespace TestProject
{
    public partial class frmInputPwsswordDialog : UIForm
    {
        public frmInputPwsswordDialog()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            try
            {
                var pwd = txt_Password.Text.Trim();
                if (string.IsNullOrEmpty(pwd))
                {
                    ShowErrorTip("密码不可为空!");
                    return;
                }
                else if (pwd == "0000" || pwd == "1")
                {
                    ShowSuccessTip("密码验证通过!");
                    Thread.Sleep(500);
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    ShowErrorTip("密码验证有误,请重新输入!");
                    txt_Password.Text = string.Empty;
                    return;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// 取消,关闭弹窗  退出程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
            Application.Exit();
        }
    }
}
